package org.sgx.gapi.client.client;

import org.sgx.jsutil.client.JsObject;

/**
 * a GAPIRequest for a list of items - it contains information about item pagination, etc. For example, fusion tables table list and youtube search are GapiListResults.
 * 
 * @author sg
 * 
 * @param <T>
 */
public abstract class GAPIListRequest<T extends GAPIResult> implements GAPIRequest<T> {
	int maxResults=0;
	String pageToken=null;

	protected JsObject getListParams() {
		JsObject params = JsObject.createObject().cast(); 
		if(getMaxResults()>0)
			params.objPut("maxResults", getMaxResults());
		if(getPageToken()!=null)
			params.objPut("pageToken", getPageToken());
		return params; 
	}
	public int getMaxResults() {
		return maxResults;
	}

	public void setMaxResults(int maxResults) {
		this.maxResults = maxResults;
	}

	public String getPageToken() {
		return pageToken;
	}

	public void setPageToken(String pageToken) {
		this.pageToken = pageToken;
	}

}
